package modele;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import org.jdom.*;
import org.jdom.input.*;
import org.jdom.filter.*;

import outils.Divers;

public class ClassReader
{

/*
 * 		List<Element> lElement;
		try {
			
				lElement = Divers.listFromXml("/home/kn/Bureau/okok", Divers.CLASSES);

				System.out.println(lElement.size());
				ModeleClasse m = new ModeleClasse(lElement.get(0));
				ModeleClasse m2 = new ModeleClasse(lElement.get(1));
				//m.affiche();
				System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");	
				//m2.affiche();
				m.addRelation(new ModeleRelation(Relations.ASSOCIATION,m,m2,Cardinalite.ETOILE,Cardinalite.UN_N),
						true);

				m2.affiche();
				System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				m.affiche();
			
				Iterator<Element> it= lElement.iterator();
				Vector<ModeleRelation> mr = new Vector<ModeleRelation>();
				//on parcours les classes
				ModeleRelation mro = new ModeleRelation(Relations.AGREGATION,
						m, m2, Cardinalite.ETOILE, Cardinalite.UN);
				
				Vector<ModeleRelation> lmrl = new Vector<ModeleRelation>();
				lmrl.add(mro);
				Vector<ModeleClasse> lc = new Vector<ModeleClasse>();
				lc.add(m);
				lc.add(m2);
				new ModeleSauvegarde(lc, lmrl).sauvegarder("/home/kn/Bureau/okok2");
				
		} catch (JDOMException e) {
			
			e.printStackTrace();
		} catch (IOException e) {
			
			e.printStackTrace();
		}	
 */
	public static void main(String args[])
	{
		try {
			
			List<Element> lElement = Divers.listFromXml("/home/kn/Bureau/okok", Divers.CLASSES);

			System.out.println(lElement.size());
			ModeleClasse m = new ModeleClasse(lElement.get(0));
			Vector<String> types = new Vector<String>();
			types.add(ModeleLangage.CHAR, "char");
			types.add(ModeleLangage.INT,"int");
			types.add(ModeleLangage.FLOAT,"float");
			types.add(ModeleLangage.DOUBLE,"double");
			types.add(ModeleLangage.LONG,"long");
			types.add(ModeleLangage.SHORT,"short");
			
			
			//ModeleLangage j = new ModeleJava("java","java", "/home/kn/workspace/IG_Projet/src/Java", types, m);
				
			
		}catch (JDOMException e) {
			
			e.printStackTrace();
		} catch (IOException e) {
			
			e.printStackTrace();
		}	
}
}